import torch
from torch.utils.data import Dataset
from torchvision import transforms
import os
from PIL import Image
import numpy as np


class preliminary(Dataset):
    def __init__(self, csv_path):
        self.data_list = []
        with open(csv_path,'r') as file:
            for line in file:
                groups = line.strip().split('|,|')
                report_id = groups[0]
                description = groups[1]
                words = description.split(' ')
                label=groups[2]
                areas = label.split(' ')
                self.data_list.append((report_id,words,areas))
    def __len__(self):
        return len(self.data_list)

    def __getitem__(self, index):
        report_id, words, areas = self.data_list[index]
        return report_id, words, areas
